import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'

const baseUrl = `http://192.168.31.203:8080`

export const apiSlice = createApi({
  reducerPath: 'api',
  baseQuery: fetchBaseQuery({ baseUrl }),
  endpoints: (builder) => ({
    fetchRecords: builder.mutation({
      query: (body) => ({
        url: 'pageHandler',
        method: 'POST',
        body
      })
    })
  })
})

export const { useFetchRecordsMutation } = apiSlice
